package tt.dz.appserver.dao.ext;

import java.util.List;

import org.apache.commons.collections.map.ListOrderedMap;
import org.springframework.stereotype.Repository;

import tt.dz.appserver.dao.base.BasisDao;
import tt.dz.appserver.entity.model.dic.City;
import tt.dz.appserver.util.StringUtils;

@Repository
public class CityDao extends BasisDao<City>{

	/**市查询*/
	public List<City> findCityByProvince(String provinceid) {
		
		ListOrderedMap map = new ListOrderedMap();
		if (StringUtils.isNotBlank(provinceid)) {
			map.put("province_id", provinceid);
		}
		
		List<City> cityList = super.findListAutomaticOfClass(City.class, map, null, null, "city_name", 1);
		
		return cityList;
	}
	
	/**市查询*/
	public List<City> findCityByProvince(String provinceid,String cityName) {
		
		ListOrderedMap map = new ListOrderedMap();
		if (StringUtils.isNotBlank(provinceid)) {
			map.put("province_id", provinceid);
		}	
		if(StringUtils.isNotBlank(cityName)){
			map.put("city_name", cityName);
		}
		List<City> cityList = super.findListAutomaticOfClass(City.class, map, null, null, "city_name", 1);
		
		return cityList;
	}
}
